<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html class="no-js">
<head>
<meta name="Keywords" content="<?php echo C('site_keyword');?>">
<meta name="Description" content="<?php echo C('site_content');?>">
<title><?php echo C('site_title');?></title>
<!-- 移动设备支持 -->
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="<?php echo STATICS;?>/amaze/css/amazeui.min.css?v=1.00">
<link rel="stylesheet" href="<?php echo RES;?>/css/app.css?v=2.27">
<script src="<?php echo STATICS;?>/amaze/js/jquery.min.js"></script>
<script src="<?php echo STATICS;?>/amaze/js/amazeui.min.js"></script>
<script src="<?php echo STATICS;?>/js/jquery.form.min.js"></script>
<script src="<?php echo RES;?>/js/common.js?v=1.00"></script>
</head>
<body>
<div id="loading" class="loading"><div class="loadMark"><i class="am-icon-spinner am-icon-pulse"></i></div></div>
<div class="page">
	

	

	<header class="am-header am-header-default">
		<div class="am-header-left am-header-nav">
		<a href="<?php echo U('Index/index');?>"><i class="am-header-icon am-icon-home"></i></a>
    	</div>
		<h1 class="am-header-title"><?php echo ($cate["name"]); ?></h1>
		<div class="am-header-right am-header-nav">
		<a href="javascript:window.history.go(-1)"><i class="am-header-icon am-icon-reply"></i></a>
    	</div>
	</header>


	<form id="search_form" name="search_form" enctype="multipart/form-data" action="<?php echo U('Store/search');?>" method="post">
		<div class="m-l-search">
			<input id="s" class="inp-search" name="s" type="search" value="" placeholder="输入关键字搜索">
			<input class="btn-search" name="search-btn" type="submit" value="搜索">
		</div>
	</form>

	
	<div class="m-select c666 order_control">
		<span><a href="javascript:" order="time">时间<i><em></em></i></a></span>
		<span><a href="javascript:" order="sellNumber">销量<i><em></em></i></a></span>
		<span><a href="javascript:" order="price" class="arrow-down">价格<i><em></em></i></a></span>
	</div>

	<ul id="m_list" class="m-list">
	<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><li>
		<span class="pic">
			<a href="<?php echo U('Store/view',array('id'=>$vo['id'],'cid'=>$vo['cid']));?>">
				<img class="am-img-responsive" src="<?php echo ($vo["picname"]); ?>" data-original="<?php echo ($vo["picname"]); ?>">
			</a>
		</span>
		<span class="con">
			<a class="t" href="<?php echo U('Store/view',array('id'=>$vo['id'],'cid'=>$vo['cid']));?>"><?php echo ($vo["name"]); ?></a>
			<?php if(($vo["baoxian"]) == "1"): ?><div>送全年交强险</div><?php endif; ?>
			<b>￥<?php echo ($vo["price"]); ?></b><del>￥<?php echo ($vo["shichang"]); ?></del>
			<span><?php echo ($vo["sellNumber"]); ?>人付款</span>
		</span>
		<div class="clear"></div>
	</li><?php endforeach; endif; else: echo "" ;endif; ?>
	</ul>

	<div class="show-more" id="show_more" page="2" style="display:none"><i class="am-icon-spinner am-icon-pulse"></i> 数据加载中...</div>

<input type="hidden" value="1" id="pageid" />
<input type="hidden" id="canScroll" value="1" />
<script>
var action="<?php echo ($action); ?>";
var s="<?php echo ($s); ?>";
$(function(){
	$('#search_form').submit(function() {
		var s= $('#s').val();
		if (s == '') {
			floatNotify.simple('请输入搜索关键词');
			return false;
		}
	});

	//点击排序
	var base_url = '/index.php?g=Wap&m=Store&a='+action+'&cid=<?php echo ($cate["id"]); ?>',
		method = 'DESC',
		_get_method = '<?php echo ($method); ?>',
		order = 'time',
		_get_order  = '<?php echo ($order); ?>';
	if (_get_order != '') {
		order = _get_order;
	}
	$('.order_control a').removeClass('arrow-down');
	if (_get_method == 'DESC')  {
		method = 'ASC';
		$('.order_control a[order="' + order + '"]').addClass('arrow-down');
	} else {
		$('.order_control a[order="' + order + '"]').addClass('arrow-up');
	}
	$('.order_control a').click(function() {
		var order = $(this).attr('order');
		var url = base_url + '&order=' + order+'&method='+method;
		location.href = url;
	});
	
	/*---------------------加载更多--------------------*/
	if(s!=''){
		var b_url = '/index.php?g=Wap&m=Store&a=ajaxProducts&keys='+encodeURI(s)+'';
	}else{
		var b_url = '/index.php?g=Wap&m=Store&a=ajaxProducts';
	}
	var total = <?php echo ($total); ?>,
		pagesize = 8,
		pages = Math.ceil(total / pagesize);
	var com_link = '/index.php?g=Wap&m=Store&a=view';
	if (pages > 1) {
		var _page = $('#show_more').attr('page');
		$(window).bind("scroll",function() {
			if ($(document).scrollTop() + $(window).height()+100 >= $(document).height()) {
				$('#show_more').css({"display":"block"}).html('<i class="am-icon-spinner am-icon-pulse"></i> 数据加载中');
				if (_page > pages) {
					$('#canScroll').attr('value',0);
					$('#show_more').hide().html('<i class="am-icon-spinner am-icon-pulse"></i> 数据加载中');
					return;
				}
				if($('#canScroll').val()==0){//不要重复加载
					return;
				}
				$('#canScroll').attr('value',0);
				$.ajax({
					type : "GET",
					data : {'page' : _page,'cid':<?php echo ($cate["id"]); ?>, 'inajax' : 1},
					url :  b_url + '&order=' + order + '&method=' + _get_method + '&pagesize='+pagesize,
					dataType : "json",
					success : function(RES) {
						$('#canScroll').attr('value',1);
						$('#show_more').hide().html('<i class="am-icon-spinner am-icon-pulse"></i> 数据加载中');
						data = RES.message;
						if(data.length>0){
							$('#show_more').attr('page',parseInt(_page)+1);
						}
						_page = $('#show_more').attr('page');
						var _tmp_html = '';						
						$.each(data, function(x, y) {
							_tmp_html +=    '<li><span class="pic">' +
							'<a href="' + com_link + '&id=' + y.id + '&cid='+y.cid+'">' +
							'<img src="' +y.picname + '" />' +
							'</a></span><span class="con"><a class="t" href="' + com_link + '&id=' + y.id + '&cid='+y.cid+'">' + y.name + '</a><b>￥'+ y.price +'&nbsp;元</b><del>￥' + y.shichang + '</del>' +
							'<span>' + parseInt(y.sellNumber) + '人付款</span></span></li>';
						});
						$('#m_list').append(_tmp_html);
					}
				})
			}
		});
	}
});
</script>

<div class="footerBox">
	<div class="sub-search sub-pop">
		<form action="<?php echo U('Store/search');?>" method="post">
			<input id="search_name" class="inp-search" name="s" type="search" value="" placeholder="输入关键字搜索" />
			<input class="btn-search" name="search-btn" type="submit" value="搜索" />
		</form>
	</div>
	<div class="footMenu">
		<li class="home"><a href="<?php echo U('Index/index');?>"><i class="am-icon-home am-icon-sm"></i>首页</a></li>
		<li><a href="<?php echo U('Store/cate');?>"><i class="am-icon-shopping-cart am-icon-sm"></i>分类</a></li>
		<li class="am-search-dropdown"><a href="javascript:;"><i class="am-icon-search am-icon-sm"></i>搜索</a></li>

		<li><a href="<?php echo U('Member/index');?>"><i class="am-icon-user am-icon-sm"></i>会员中心</a></li>

	</div>
	<script>
	$(document).ready(function(){
		$(".am-search-dropdown").click( function() {
			$('.sub-search').toggle();
		});
	});
	</script>
</div>

	
	<div class="kefu"><a href="http://chat32.live800.com/live800/chatClient/chatbox.jsp?companyID=672718&configID=95684&jid=7284455908"><i class="am-icon-headphones"></i></a></div>
	<footer data-am-widget="footer" class="am-footer am-footer-default"  data-am-footer="{}">
	    <div class="am-footer-miscs ">
	        <p>版权所有：<?php echo C("copyright");?></p>
	    </div>
	</footer>

	<script>
	var mid = document.getElementById("loading");
	wh = $(document).height();
	ww = $(document).width();
	$(mid).height(wh);
	$(".loadMark").css("left",(ww/2)-40);
	$("body").css({overflow:"hidden"});//禁用滚动条
	$(window).load(function() {
	   $(mid).hide();
	   $("body").css({overflow:"auto"});//禁用滚动条
	});
	</script>

</div>
</body>
</html>